}
}
-bool FolderMan::pushNotificationsFilesReady(Account *account)
+bool FolderMan::pushNotificationsFilesReady(const AccountPtr &account)
{
const auto pushNotifications = account->pushNotifications();
const auto pushFilesAvailable = account->capabilities().availablePushNotifications() & PushNotificationType::Files;
// Some folders need not to be checked because they use the push notifications
std::copy_if(folderMapValues.begin(), folderMapValues.end(), std::back_inserter(foldersToRun), [this](Folder *folder) -> bool {
const auto account = folder->accountState()->account();
- return !pushNotificationsFilesReady(account.data());
+ return !pushNotificationsFilesReady(account);
});
qCInfo(lcFolderMan) << "Number of folders that don't use push notifications:" << foldersToRun.size();
return;
}
// When not using push notifications, make sure polltime is reached
- if (!pushNotificationsFilesReady(folder->accountState()->account().data())) {
+ if (!pushNotificationsFilesReady(folder->accountState()->account())) {
if (folder->msecSinceLastSync() < polltime) {
qCInfo(lcFolderMan) << "Can not run etag job: Polltime not reached";
return;
// See if the account already provides the PushNotifications object and if yes connect to it.
// If we can't connect at this point, the signals will be connected in slotPushNotificationsReady()
// after the PushNotification object emitted the ready signal
- slotConnectToPushNotifications(account.data());
+ slotConnectToPushNotifications(account);
connect(account.data(), &Account::pushNotificationsReady, this, &FolderMan::slotConnectToPushNotifications, Qt::UniqueConnection);
}
}
}
}
-void FolderMan::slotConnectToPushNotifications(Account *account)
+void FolderMan::slotConnectToPushNotifications(const AccountPtr &account)
{
const auto pushNotifications = account->pushNotifications();
void slotSetupPushNotifications(const OCC::Folder::Map &);
void slotProcessFilesPushNotification(OCC::Account *account);
- void slotConnectToPushNotifications(OCC::Account *account);
+ void slotConnectToPushNotifications(const OCC::AccountPtr &account);
void slotLeaveShare(const QString &localFile, const QByteArray &folderToken = {});
void runEtagJobsIfPossible(const QList<Folder *> &folderMap);
void runEtagJobIfPossible(Folder *folder);
- bool pushNotificationsFilesReady(Account *account);
+ bool pushNotificationsFilesReady(const OCC::AccountPtr &account);
[[nodiscard]] bool isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) const;
connect(_pushNotifications, &PushNotifications::ready, this, [this]() {
_pushNotificationsReconnectTimer.stop();
- emit pushNotificationsReady(this);
+ emit pushNotificationsReady(sharedFromThis());
});
const auto disablePushNotifications = [this]() {